<body>
    <h1>0</h1>
    </body>
    <script>
    
    setInterval( function (){
        
        let fontObj = document.createElement('div')
        let index = Math.floor(Math.random()*(25-0+1))
    
        let str = 'ylkjhgfdsapoiuytrewqmnbvcxz'.split('')[index]
        fontObj.innerText = str
        fontObj.style.fontSize = `${150}px`
        fontObj.style.color = 'green'
       
        let maxLeft = window.innerWidth  - 150
        let maxTop = window.innerHeight  - 150
    
        fontObj.style.position = 'absolute'
        fontObj.style.left = Math.floor(Math.random()*(maxLeft-0+1)+0) + 'px'
        fontObj.style.top = Math.floor(Math.random()*(maxTop-0+1)+0) + 'px'
    
        document.body.appendChild(fontObj)
    
    }, 1500);
    let num = 0
    document.body.onkeyup = function (evt){
    
        let e = evt ||window.event
        let fontObjs =  document.querySelectorAll('div')
    
        fontObjs.forEach(function(item){
        
            if(e.key.toUpperCase()== item.innerText) {
                
                document.body.removeChild(item)
                num++
                let hObj = document.querySelector('h1')
                hObj.innerText = num
                
            }
        })
        
    }
    
    </script>